Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce a limit of 50 URNs per contact #1301

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Enforce a limit of 50 URNs per contact #1301

merged 1 commit into from
Jan 8, 2025

Conversation

rowanseymour
Copy link
Member

No description provided.

@rowanseymour rowanseymour requested a review from norkans7 January 8, 2025 15:49
@@ -60,9 +60,16 @@ func (m *URNsModifier) Apply(eng flows.Engine, env envs.Environment, sa flows.Se
log(events.NewErrorf("'%s' is not valid URN", urn))
} else {
if m.Modification == URNsAppend || m.Modification == URNsSet {
modified = contact.AddURN(urn, nil)
if len(contact.URNs()) >= flows.MaxContactURNs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the error message says we allow 50 so we use > flows.MaxContactURNs and not >= flows.MaxContactURNs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is checking if the modifier should be allowed to add one more URN tho

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think the unit test added should not be an error as that has exactly 50 urns, we need one more urn to have that as error and use > comparison

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the unit test is adding 50 urns but the contact already has 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh right

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.75%. Comparing base (6574946) to head (4a91e28).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1301   +/-   ##
=======================================
  Coverage   81.74%   81.75%           
=======================================
  Files         276      276           
  Lines       21326    21332    +6     
=======================================
+ Hits        17434    17440    +6     
  Misses       3318     3318           
  Partials      574      574           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rowanseymour rowanseymour merged commit 2331736 into main Jan 8, 2025
7 checks passed
@rowanseymour rowanseymour deleted the urn_limit branch January 8, 2025 16:09
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants